{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "#载入数据:\n",
    "train = pd.read_csv('Train.csv')\n",
    "test = pd.read_csv('Test.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train dataset dimensions: (87020, 26)\n",
      "Test dataset dimensions: (37717, 24)\n"
     ]
    }
   ],
   "source": [
    "print (\"Train dataset dimensions:\", train.shape)\n",
    "print (\"Test dataset dimensions:\", test.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAEKCAYAAADaa8itAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAFeFJREFUeJzt3X2wZVV95vHvA4i0CgLaWKaBNMaOSnR8awmaTIyg2OgEkJIEyxFGmcFkwJdJdIQkJVFEJRGMJL6ECgRwDIgEtFWUQQScOIo0L4oNUnQwQg8EWkHkZYBp+M0fZ1043X1fdt/ep28f7/dTdeqevc7a+/wOBTy19tp77VQVkiT1Yau5LkCS9MvDUJEk9cZQkST1xlCRJPXGUJEk9cZQkST1xlCRJPXGUJEk9cZQkST1Zpu5LmBze/rTn16LFy+e6zIkaWxcddVVP62qhV36zrtQWbx4MStWrJjrMiRpbCT5Sde+nv6SJPXGUJEk9cZQkST1xlCRJPXGUJEk9cZQk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zRHKtIsVNWdwJHA0Rl4bCSS5JVtRHNtkmuSbN922yHJBUmuT/KZoVHOfRPHTfLGJGe092ckOTnJpcCJUx03yXuTXJnkB0k+MHSsP2vPvPkG8JzN8c9FcqQizVJV3dyCYZf1PnoPcFRVfTvJU4AHW/teDJ4/8xPg68DBwHkzfM2vA6+uqkeSfHn94ybZD1jSjh1geZLfAe5nsHzOixn8d341cNWm/WJpZo5UpE0z2YrN3wZOTvJOYMeh01bfa8+geQQ4G/jtDsf/Qus/1XH3a69rGATHcxmEzL8HLqiqB6rqF7g2mzYTQ0WapSTPAh4B7hxur6qPAv8ZWAB8N8lzJz5a7xA1Sft26/W5f4bjBvhIVb2ovZ5dVadN8X3SyBkq0iwkWQh8BvjbWm8BvSS/VlXXVdWJDCbvJ0Jlr7ay81bAHwD/3NrvSPK81v6Gab5zsuNeBLytnQ4jyaJ2EcG3gDckWdDmXn6vr98uTcc5Fam7BUmuBZ4ArAU+C5w8Sb93J3kVg1HM9cDXgJczWDn3o8ALGPxP/4LW/xjgKwyepvlD4ClTfP8Gx62qh5I8D/hOEoD7gP9YVVcn+TxwLYM5nP+1KT9c6spViiVJvfH0lySpN4aKJKk3hookqTeGiiSpN4aKJKk3hookqTeGiiSpN4aKJKk3/x++6iyfp4e+ywAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "sns.countplot(train['Disbursed']);\n",
    "plt.xlabel('Disbursed');\n",
    "plt.ylabel('Number of occurrences');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Monthly_Income</th>\n",
       "      <th>Loan_Amount_Applied</th>\n",
       "      <th>Loan_Tenure_Applied</th>\n",
       "      <th>Existing_EMI</th>\n",
       "      <th>Var5</th>\n",
       "      <th>Loan_Amount_Submitted</th>\n",
       "      <th>Loan_Tenure_Submitted</th>\n",
       "      <th>Interest_Rate</th>\n",
       "      <th>Processing_Fee</th>\n",
       "      <th>EMI_Loan_Submitted</th>\n",
       "      <th>Var4</th>\n",
       "      <th>LoggedIn</th>\n",
       "      <th>Disbursed</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>8.702000e+04</td>\n",
       "      <td>8.694900e+04</td>\n",
       "      <td>86949.000000</td>\n",
       "      <td>8.694900e+04</td>\n",
       "      <td>87020.000000</td>\n",
       "      <td>5.240700e+04</td>\n",
       "      <td>52407.000000</td>\n",
       "      <td>27726.000000</td>\n",
       "      <td>27420.000000</td>\n",
       "      <td>27726.000000</td>\n",
       "      <td>87020.000000</td>\n",
       "      <td>87020.000000</td>\n",
       "      <td>87020.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>5.884997e+04</td>\n",
       "      <td>2.302507e+05</td>\n",
       "      <td>2.131399</td>\n",
       "      <td>3.696228e+03</td>\n",
       "      <td>4.961503</td>\n",
       "      <td>3.950106e+05</td>\n",
       "      <td>3.891369</td>\n",
       "      <td>19.197474</td>\n",
       "      <td>5131.150839</td>\n",
       "      <td>10999.528377</td>\n",
       "      <td>2.949805</td>\n",
       "      <td>0.029350</td>\n",
       "      <td>0.014629</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>2.177511e+06</td>\n",
       "      <td>3.542068e+05</td>\n",
       "      <td>2.014193</td>\n",
       "      <td>3.981021e+04</td>\n",
       "      <td>5.670385</td>\n",
       "      <td>3.082481e+05</td>\n",
       "      <td>1.165359</td>\n",
       "      <td>5.834213</td>\n",
       "      <td>4725.837644</td>\n",
       "      <td>7512.323050</td>\n",
       "      <td>1.697720</td>\n",
       "      <td>0.168785</td>\n",
       "      <td>0.120062</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>5.000000e+04</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>11.990000</td>\n",
       "      <td>200.000000</td>\n",
       "      <td>1176.410000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.650000e+04</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>2.000000e+05</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>15.250000</td>\n",
       "      <td>2000.000000</td>\n",
       "      <td>6491.600000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>2.500000e+04</td>\n",
       "      <td>1.000000e+05</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>3.000000e+05</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>18.000000</td>\n",
       "      <td>4000.000000</td>\n",
       "      <td>9392.970000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>4.000000e+04</td>\n",
       "      <td>3.000000e+05</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>3.500000e+03</td>\n",
       "      <td>11.000000</td>\n",
       "      <td>5.000000e+05</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>6250.000000</td>\n",
       "      <td>12919.040000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>4.445544e+08</td>\n",
       "      <td>1.000000e+07</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>1.000000e+07</td>\n",
       "      <td>18.000000</td>\n",
       "      <td>3.000000e+06</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>37.000000</td>\n",
       "      <td>50000.000000</td>\n",
       "      <td>144748.280000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Monthly_Income  Loan_Amount_Applied  Loan_Tenure_Applied  Existing_EMI  \\\n",
       "count    8.702000e+04         8.694900e+04         86949.000000  8.694900e+04   \n",
       "mean     5.884997e+04         2.302507e+05             2.131399  3.696228e+03   \n",
       "std      2.177511e+06         3.542068e+05             2.014193  3.981021e+04   \n",
       "min      0.000000e+00         0.000000e+00             0.000000  0.000000e+00   \n",
       "25%      1.650000e+04         0.000000e+00             0.000000  0.000000e+00   \n",
       "50%      2.500000e+04         1.000000e+05             2.000000  0.000000e+00   \n",
       "75%      4.000000e+04         3.000000e+05             4.000000  3.500000e+03   \n",
       "max      4.445544e+08         1.000000e+07            10.000000  1.000000e+07   \n",
       "\n",
       "               Var5  Loan_Amount_Submitted  Loan_Tenure_Submitted  \\\n",
       "count  87020.000000           5.240700e+04           52407.000000   \n",
       "mean       4.961503           3.950106e+05               3.891369   \n",
       "std        5.670385           3.082481e+05               1.165359   \n",
       "min        0.000000           5.000000e+04               1.000000   \n",
       "25%        0.000000           2.000000e+05               3.000000   \n",
       "50%        2.000000           3.000000e+05               4.000000   \n",
       "75%       11.000000           5.000000e+05               5.000000   \n",
       "max       18.000000           3.000000e+06               6.000000   \n",
       "\n",
       "       Interest_Rate  Processing_Fee  EMI_Loan_Submitted          Var4  \\\n",
       "count   27726.000000    27420.000000        27726.000000  87020.000000   \n",
       "mean       19.197474     5131.150839        10999.528377      2.949805   \n",
       "std         5.834213     4725.837644         7512.323050      1.697720   \n",
       "min        11.990000      200.000000         1176.410000      0.000000   \n",
       "25%        15.250000     2000.000000         6491.600000      1.000000   \n",
       "50%        18.000000     4000.000000         9392.970000      3.000000   \n",
       "75%        20.000000     6250.000000        12919.040000      5.000000   \n",
       "max        37.000000    50000.000000       144748.280000      7.000000   \n",
       "\n",
       "           LoggedIn     Disbursed  \n",
       "count  87020.000000  87020.000000  \n",
       "mean       0.029350      0.014629  \n",
       "std        0.168785      0.120062  \n",
       "min        0.000000      0.000000  \n",
       "25%        0.000000      0.000000  \n",
       "50%        0.000000      0.000000  \n",
       "75%        0.000000      0.000000  \n",
       "max        1.000000      1.000000  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:4: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version\n",
      "of pandas will change to not sort by default.\n",
      "\n",
      "To accept the future behavior, pass 'sort=True'.\n",
      "\n",
      "To retain the current behavior and silence the warning, pass sort=False\n",
      "\n",
      "  after removing the cwd from sys.path.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(124737, 27)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "train['source']= 'train'\n",
    "test['source'] = 'test'\n",
    "data = pd.concat([train, test],ignore_index=True)\n",
    "data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "City                      1401\n",
       "DOB                          0\n",
       "Device_Type                  0\n",
       "Disbursed                37717\n",
       "EMI_Loan_Submitted       84901\n",
       "Employer_Name              113\n",
       "Existing_EMI               111\n",
       "Filled_Form                  0\n",
       "Gender                       0\n",
       "ID                           0\n",
       "Interest_Rate            84901\n",
       "Lead_Creation_Date           0\n",
       "Loan_Amount_Applied        111\n",
       "Loan_Amount_Submitted    49535\n",
       "Loan_Tenure_Applied        111\n",
       "Loan_Tenure_Submitted    49535\n",
       "LoggedIn                 37717\n",
       "Mobile_Verified              0\n",
       "Monthly_Income               0\n",
       "Processing_Fee           85346\n",
       "Salary_Account           16801\n",
       "Source                       0\n",
       "Var1                         0\n",
       "Var2                         0\n",
       "Var4                         0\n",
       "Var5                         0\n",
       "source                       0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.apply(lambda x: sum(x.isnull()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "cat_features = ['City','Employer_Name','Salary_Account', 'Source']\n",
    "rare_thresholds = [100, 30, 40, 40]\n",
    "j=0\n",
    "for col in cat_features:\n",
    "    #每个取值的样本数目\n",
    "    value_counts_col =  data[col].value_counts(dropna=False)\n",
    "\n",
    "    #样本数目小于阈值的取值为稀有取值\n",
    "    rare_threshold = rare_thresholds[j]\n",
    "    value_counts_rare = list(value_counts_col[value_counts_col < rare_threshold ].index)\n",
    "\n",
    "    #稀有值合并为：others\n",
    "    rare_index = data[col].isin(value_counts_rare)\n",
    "    data.loc[ data[col].isin(value_counts_rare), col] = \"Others\"\n",
    "    \n",
    "    j = j+1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAD9CAYAAABA8iukAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAG55JREFUeJzt3X901fWd5/HnSyKEShVtaw4SzuK0nG6Q2ZmpGXRGtycpM4DWLc6cdivtjLRNy8Eqbdd1FMmepdM2MzKdU6e2AosNC3bbYMdpVzq1IovJdrKjVNRW0NQStSMpjNYFWbEa+fHeP+4n9hIuyZd7ubm58fU45558v+/v5/v9fsJJ8uLz+X7v9yoiMDMzy+K0SnfAzMyqh0PDzMwyc2iYmVlmDg0zM8vMoWFmZpk5NMzMLDOHhpmZZebQMDOzzBwaZmaWWU2lO3Cqvf3tb4/p06dXuhtmx3nllVc444wzKt0Ns4IeeeSRFyPiHcO1G3OhMX36dLZv317pbpgdp6uri6ampkp3w6wgSf+SpZ2np8zMLDOHhpmZZebQMDOzzBwaZmaWmUPDzMwyc2iYlVlHRwezZs1izpw5zJo1i46Ojkp3yaxoY+6WW7PRpKOjg9bWVtrb2zly5Ajjxo2jpaUFgIULF1a4d2YnzyMNszJqa2ujvb2d5uZmampqaG5upr29nba2tkp3zawoDg2zMurp6eHSSy89pnbppZfS09NToR6ZlcahYVZGDQ0NdHd3H1Pr7u6moaGhQj0yK41Dw6yMWltbaWlpobOzk8OHD9PZ2UlLSwutra2V7ppZUYa9EC5pHXAF8EJEzBq07Qbgy8A7IuJFSQK+ClwO/Br4WEQ8mtouAv5L2vVLEbEh1S8E1gMTgXuBz0ZESDoHuAuYDvwC+I8Rsb+k79ZshA1c7F66dCk9PT00NDTQ1tbmi+BWtbKMNNYD8wcXJU0D/hh4Lq98GTAjvRYD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4yM7PMPD1lZmaZOTTMzCwzh4aZmWXm0DAzs8wcGmZmltn/B9JRy3+cNRJ7AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "data['Age'] = data['DOB'].apply(lambda x: 115 - int(x[-2:]))  \n",
    "  \n",
    "data.drop('DOB',axis=1,inplace=True)#删除原先的字段  \n",
    "  \n",
    "  \n",
    "data.boxplot(column=['EMI_Loan_Submitted'],return_type='axes')#画出箱线图  \n",
    "  \n",
    "#好像缺失值比较多，干脆就开一个新的字段，表明是缺失值还是不是缺失值  \n",
    "data['EMI_Loan_Submitted_Missing'] = data['EMI_Loan_Submitted'].apply(lambda x: 1 if pd.isnull(x) else 0)  \n",
    "data[['EMI_Loan_Submitted','EMI_Loan_Submitted_Missing']].head(10)  \n",
    "data.drop('EMI_Loan_Submitted',axis=1,inplace=True)  \n",
    "#看看个数  \n",
    "len(data['Employer_Name'].value_counts())  \n",
    "#看看某一字段的信息  \n",
    "data['Existing_EMI'].describe()  \n",
    "#缺省值不多，用均值代替  \n",
    "data['Existing_EMI'].fillna(0, inplace=True)  \n",
    "  \n",
    "#找中位数去填补缺省值（因为缺省的不多）  \n",
    "data['Loan_Amount_Applied'].fillna(data['Loan_Amount_Applied'].median(),inplace=True)  \n",
    "data['Loan_Tenure_Applied'].fillna(data['Loan_Tenure_Applied'].median(),inplace=True)  \n",
    "  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "S122      55249\n",
       "S133      42900\n",
       "others    26588\n",
       "Name: Source, dtype: int64"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#处理source  \n",
    "data['Source'] = data['Source'].apply(lambda x: 'others' if x not in ['S122','S133'] else x)  \n",
    "data['Source'].value_counts()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "#数值编码  \n",
    "from sklearn.preprocessing import LabelEncoder  \n",
    "le = LabelEncoder()  \n",
    "feats_to_encode = ['Device_Type','Filled_Form','Gender','Var1','Var2','Mobile_Verified','Source']  \n",
    "for col in feats_to_encode:  \n",
    "    data[col] = le.fit_transform(data[col])  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "train = data.loc[data['source']=='train']\n",
    "test = data.loc[data['source']=='test']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py:3694: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  errors=errors)\n"
     ]
    }
   ],
   "source": [
    "train.drop('source',axis=1,inplace=True)\n",
    "test.drop(['source','Disbursed'],axis=1,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "train.to_csv('FE_train.csv',index=False)\n",
    "test.to_csv('FE_test.csv',index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/__init__.py:46: UserWarning: Starting from version 2.2.1, the library file in distribution wheels for macOS is built by the Apple Clang (Xcode_8.3.1) compiler.\n",
      "This means that in case of installing LightGBM from PyPI via the ``pip install lightgbm`` command, you don't need to install the gcc compiler anymore.\n",
      "Instead of that, you need to install the OpenMP library, which is required for running LightGBM on the system with the Apple Clang compiler.\n",
      "You can install the OpenMP library by the following command: ``brew install libomp``.\n",
      "  \"You can install the OpenMP library by the following command: ``brew install libomp``.\", UserWarning)\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd \n",
    "import numpy as np\n",
    "\n",
    "import lightgbm as lgbm\n",
    "from lightgbm.sklearn import LGBMClassifier\n",
    "\n",
    "from sklearn.model_selection import GridSearchCV\n",
    "\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "train = pd.read_csv(\"FE_train.csv\")\n",
    "train = train.drop([\"City\", \"Employer_Name\", \"Lead_Creation_Date\", \"Salary_Account\"], axis=1)\n",
    "\n",
    "y_train = train['Disbursed'] \n",
    "X_train = train.drop([\"ID\", \"Disbursed\"], axis=1)\n",
    "feat_names = X_train.columns "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "MAX_ROUNDS = 10000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import StratifiedKFold\n",
    "\n",
    "kfold = StratifiedKFold(n_splits=5, shuffle=True, random_state=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_n_estimators(params , X_train , y_train , early_stopping_rounds=10):\n",
    "    lgbm_params = params.copy()\n",
    "     \n",
    "    lgbmtrain = lgbm.Dataset(X_train , y_train )\n",
    "     \n",
    "    \n",
    "    cv_result = lgbm.cv(lgbm_params , lgbmtrain , num_boost_round=MAX_ROUNDS , nfold=5,  metrics='auc' , early_stopping_rounds=early_stopping_rounds,seed=3 )\n",
    "     \n",
    "    print('best n_estimators:' , len(cv_result['auc-mean']))\n",
    "    print('best cv score:' , cv_result['auc-mean'][-1])\n",
    "     \n",
    "    return len(cv_result['auc-mean'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "best n_estimators: 22\n",
      "best cv score: 0.989476987001\n"
     ]
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          #'categorical_feature': names:'City', 'Employer_Name', 'Salary_Account','Device_Type','Filled_Form','Gender','Mobile_Verified','Source','Var1','Var2','Var4',\n",
    "          'categorical_feature': [0,1,3,5,6,12,15,16,17,18,19,20],\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          #'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'colsample_bytree': 0.7,\n",
    "          'verbosity':5\n",
    "         }\n",
    "\n",
    "#categorical_feature = ['City', 'Employer_Name', 'Salary_Account','Device_Type','Filled_Form','Gender','Mobile_Verified','Source','Var1','Var2','Var4']\n",
    "n_estimators_1 = get_n_estimators(params, X_train , y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 4 candidates, totalling 20 fits\n",
      "[CV] num_leaves=50 ...................................................\n",
      "[CV] num_leaves=50 ...................................................\n",
      "[CV] num_leaves=50 ...................................................\n",
      "[CV] num_leaves=50 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .......... num_leaves=50, score=0.9810422454696164, total=   1.4s\n",
      "[CV] num_leaves=50 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ........... num_leaves=50, score=0.991186074429772, total=   1.9s\n",
      "[CV] num_leaves=60 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .......... num_leaves=50, score=0.9897770720085145, total=   2.6s\n",
      "[CV] .......... num_leaves=50, score=0.9910440098833866, total=   2.7s\n",
      "[CV] num_leaves=60 ...................................................\n",
      "[CV] num_leaves=60 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .......... num_leaves=50, score=0.9941940096137466, total=   2.3s\n",
      "[CV] num_leaves=60 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .......... num_leaves=60, score=0.9907364088492541, total=   2.4s\n",
      "[CV] num_leaves=60 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .......... num_leaves=60, score=0.9815960669982278, total=   2.5s\n",
      "[CV] .......... num_leaves=60, score=0.9910540716374018, total=   2.4s\n",
      "[CV] num_leaves=70 ...................................................\n",
      "[CV] num_leaves=70 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ........... num_leaves=60, score=0.993991637904554, total=   2.6s\n",
      "[CV] num_leaves=70 ...................................................\n",
      "[CV] ........... num_leaves=60, score=0.989033473635202, total=   3.2s\n",
      "[CV] num_leaves=70 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done  10 tasks      | elapsed:    8.1s\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .......... num_leaves=70, score=0.9907364088492541, total=   3.4s\n",
      "[CV] num_leaves=70 ...................................................\n",
      "[CV] .......... num_leaves=70, score=0.9815960669982278, total=   3.5s\n",
      "[CV] .......... num_leaves=70, score=0.9910540716374018, total=   1.7s\n",
      "[CV] num_leaves=80 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] num_leaves=80 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ........... num_leaves=70, score=0.989033473635202, total=   3.2s\n",
      "[CV] num_leaves=80 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .......... num_leaves=80, score=0.9815960669982278, total=   1.9s\n",
      "[CV] num_leaves=80 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .......... num_leaves=80, score=0.9907364088492541, total=   2.4s\n",
      "[CV] num_leaves=80 ...................................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ........... num_leaves=70, score=0.993991637904554, total=   2.8s\n",
      "[CV] .......... num_leaves=80, score=0.9910540716374018, total=   2.6s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done  18 out of  20 | elapsed:   14.7s remaining:    1.6s\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ........... num_leaves=80, score=0.993991637904554, total=   1.4s\n",
      "[CV] ........... num_leaves=80, score=0.989033473635202, total=   2.2s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done  20 out of  20 | elapsed:   15.3s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 3, 5, 6, 12, 15, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=0.7, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=20, min_child_weight=....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid=True, n_jobs=4,\n",
       "       param_grid={'num_leaves': range(50, 90, 10)},\n",
       "       pre_dispatch='2*n_jobs', refit=False, return_train_score='warn',\n",
       "       scoring='roc_auc', verbose=5)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': [0,1,3,5,6,12,15,16,17,18,19,20],\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          #'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "num_leaves_s = range(50,90,10) #50,60,70,80\n",
    "tuned_parameters = dict( num_leaves = num_leaves_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4, param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(X_train , y_train)\n",
    "#grid_search.best_estimator_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.989448547338\n",
      "{'num_leaves': 50}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('mean_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('std_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaUAAAELCAYAAAB5xJkwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XmUVeWd7//3h6oCRHBiUgEZq1RQgqYUhwiEwZjJMWm1TUxyc9s4EOd7o78kve61r8s0TsFETYytiek2auwMYrdBQHBEYxFAgoSiGGQUyw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TZR0dToD+IuSDmrmfj8t6el0RvepOfPH/ZOklyXNl/Sf6fQx+yu5gWOHtE8XSasklUkaLOlP6XaelXRE2uer6U3f5kt6Ji+/PGvXHEpm+VMO3BkRw4B3gXOa6H8U8I8kE3beCGxOZwCfDVzY1M4klQE/Ab4SEZ8G7ku3A8mN2Y6LiE8Bi4Bvp9PgzAdGp32+DExNJ+C8B/huup1rgbvSPv8MfC7dzulN1WS2p0qb7mJme2l5RMxLn88BBjTRf2ZEbAQ2StoATEnbFwDDm7G/w0mCbVoyhyYlJLdKADhK0v8DDgC6AlPT9odJ5jebSXIPoLskdSWZEfq36XYAOqU/nwd+md6J9HfNqMlsjziUzPInd6LKHcA+JJNb1p+h6Lyb/jtzXu+keX+rAhZGxImNLPslcGZEzJf0TWBM2v4YcFN6evDTwFMk9855NyJGNNxIRFwsaSTwRWCepBER8VYzajNrFp++M2tdK0j+8Ye/3wKgpSwGeko6EZLTeZKGpcu6AevSU3wX1K8QEZuAPwOTgcfT+/68ByyX9NV0O5L0qfT54Ih4KSL+GXgT6NfCx2DtnEPJrHXdAlwi6QWgR0tuOCK2kQTdv0qaD8wjOQ0H8EPgJWAa8LcGqz4MfC39We8C4NvpdhaS3IUU4GZJCyT9FXiG5DMpsxbjW1eYmVnB8EjJzMwKhi90MCsSku4ETm7QPDki7s+iHrN88Ok7MzMrGD59Z2ZmBcOhZGZmBcOhZGZmBcOhZGZmBcOhZGZmBeP/B3e9HfcZCC3aAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_means = grid_search.cv_results_[ 'mean_test_score' ]\n",
    "test_stds = grid_search.cv_results_[ 'std_test_score' ]\n",
    "train_means = grid_search.cv_results_[ 'mean_train_score' ]\n",
    "train_stds = grid_search.cv_results_[ 'std_train_score' ]\n",
    "\n",
    "n_leafs = len(num_leaves_s)\n",
    "\n",
    "x_axis = num_leaves_s\n",
    "plt.plot(x_axis, test_means)\n",
    "#plt.errorbar(x_axis, -test_means, yerr=test_stds,label = ' Test')\n",
    "#plt.errorbar(x_axis, -train_means, yerr=train_stds,label = ' Train')\n",
    "plt.xlabel( 'num_leaves' )\n",
    "plt.ylabel( 'AUC' )\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.98944855,  0.98928221,  0.98928221,  0.98928221])"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_means"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 4 candidates, totalling 20 fits\n",
      "[CV] min_child_samples=10 ............................................\n",
      "[CV] min_child_samples=10 ............................................\n",
      "[CV] min_child_samples=10 ............................................\n",
      "[CV] min_child_samples=10 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=10, score=0.9792358086091579, total=   2.3s\n",
      "[CV] min_child_samples=10 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=10, score=0.9911868181875351, total=   2.5s\n",
      "[CV] min_child_samples=20 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=10, score=0.9911262790830618, total=   3.3s\n",
      "[CV] ... min_child_samples=10, score=0.9879726005005687, total=   3.2s\n",
      "[CV] min_child_samples=20 ............................................\n",
      "[CV] min_child_samples=20 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=20, score=0.9810422454696164, total=   1.7s\n",
      "[CV] min_child_samples=20 ............................................\n",
      "[CV] ... min_child_samples=20, score=0.9910440098833866, total=   1.6s\n",
      "[CV] min_child_samples=20 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .... min_child_samples=10, score=0.994161639323337, total=   3.6s\n",
      "[CV] .... min_child_samples=20, score=0.991186074429772, total=   3.2s\n",
      "[CV] min_child_samples=30 ............................................\n",
      "[CV] min_child_samples=30 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=30, score=0.9915431315383296, total=   1.1s\n",
      "[CV] min_child_samples=30 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=30, score=0.9840693991882468, total=   2.1s\n",
      "[CV] ... min_child_samples=20, score=0.9897770720085145, total=   3.2s\n",
      "[CV] min_child_samples=30 ............................................\n",
      "[CV] ... min_child_samples=20, score=0.9941940096137466, total=   3.1s\n",
      "[CV] min_child_samples=30 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done  10 tasks      | elapsed:   10.0s\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] min_child_samples=40 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=40, score=0.9915088321042704, total=   1.8s\n",
      "[CV] ... min_child_samples=30, score=0.9941703632313906, total=   2.0s\n",
      "[CV] min_child_samples=40 ............................................\n",
      "[CV] min_child_samples=40 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=30, score=0.9914233837450077, total=   4.0s\n",
      "[CV] min_child_samples=40 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=30, score=0.9901181079404552, total=   3.7s\n",
      "[CV] min_child_samples=40 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=40, score=0.9908307693011312, total=   2.5s\n",
      "[CV] ... min_child_samples=40, score=0.9898475520025272, total=   2.2s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done  18 out of  20 | elapsed:   15.9s remaining:    1.8s\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=40, score=0.9835945806894186, total=   3.4s\n",
      "[CV] ... min_child_samples=40, score=0.9941470612138262, total=   2.5s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done  20 out of  20 | elapsed:   16.8s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 3, 5, 6, 12, 15, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=0.7, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=20, min_child_weight=....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid=True, n_jobs=4,\n",
       "       param_grid={'min_child_samples': range(10, 50, 10)},\n",
       "       pre_dispatch='2*n_jobs', refit=False, return_train_score='warn',\n",
       "       scoring='roc_auc', verbose=5)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': [0,1,3,5,6,12,15,16,17,18,19,20],\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 50,\n",
    "          'max_depth': 6,\n",
    "          'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "min_child_samples_s = range(10,50,10) \n",
    "tuned_parameters = dict( min_child_samples = min_child_samples_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4,  param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(X_train , y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.990264777428\n",
      "{'min_child_samples': 30}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('mean_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('std_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAD8CAYAAABpcuN4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3Xl8FPX9x/HXh1wIhCsJV8IpIAQIiYQEsBUFD9QqIFZEBRE5vHprqz1+Vqo/j/qz1WorCBFQFBAt4EkVsV5cgSRgCEcEhCQc4Qo3Icnn98cOdRtDskCS2c1+no9HHtmd+c7s58uQfe/M7HdGVBVjjDHmTOq5XYAxxhj/ZkFhjDGmUhYUxhhjKmVBYYwxplIWFMYYYyplQWGMMaZSFhTGGGMqZUFhjDGmUhYUxhhjKhXqdgHVITo6Wjt06OB2GcYYE1BWr169V1VjqmpXJ4KiQ4cOpKenu12GMcYEFBH51pd2dujJGGNMpSwojDHGVMqCwhhjTKUsKIwxxlTKgsIYY0ylLCiMMcZUyoLCGGNMpSwojDFV2rT7MLOWbWNX0Qm3SzEuqBMD7owxNWfjrsPcMnUZB46d4pFF2fTvFMWwxFiG9GpF4/phbpdnaoHtURhjzmhL4RFum7aCsJB6zB6fyk8GdSH/4HF+/dZakh/7mHteW82HX+/iZEmp26WaGiSq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dPb5HFnm/xFRCJcLPFs/BX4NVDmPI+iFraJBUXd8g/gQjy72DuB/3O3HN+JSCPgLeDnqnrI7XrORwV9CcjtoqqlqpoIxAEpQPeKmtVuVWevfD9EpCfwMNAN6As0B37jYok+EZEfAXtUdbX35AqaVvs2saCA3SLSGsD5vcfles6Zqu52/ijKgJfx/HH7PREJw/PGOltV33YmB+R2qagvgbpdTlPVg8CneM67NBWRUGdWHFDgVl1ny6sfQ5zDhKqqJ4FXCIxtcglwg4hsA+bgOeT0V2phm1hQwCLgDufxHcBCF2s5L6ffWB3Dga/P1NZfOMdYpwM5qvqs16yA2y5n6kuAbpcYEWnqPL4AuALPOZelwE1OM7/fLmfoxwavDyGC55i+328TVX1YVeNUtQNwC/CJqt5GLWyToBpwJyJvAJfhudribuARYAEwD2gHbAd+rKp+f5L4DH25DM/hDQW2AZNOH+f3VyLyA+BzYB3fHXf9LZ5j+wG1XSrpyygCb7sk4DkxGoLnA+U8VZ0sIp3wfJptDmQAtzufyv1SJf34BIjBc+gmE7jb66S33xORy4AHVPVHtbFNgioojDHGnD079GSMMaZSFhTGGGMqZUFhjDGmUhYUxhhjKmVBYYwxplIWFMYYYyplQWGMMaZSFhTGGGMq9f9Zos3WCUNcaQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_means = grid_search.cv_results_[ 'mean_test_score' ]\n",
    "test_stds = grid_search.cv_results_[ 'std_test_score' ]\n",
    "train_means = grid_search.cv_results_[ 'mean_train_score' ]\n",
    "train_stds = grid_search.cv_results_[ 'std_train_score' ]\n",
    "\n",
    "x_axis = min_child_samples_s\n",
    "\n",
    "plt.plot(x_axis, test_means)\n",
    "#plt.errorbar(x_axis, -test_scores, yerr=test_stds ,label = ' Test')\n",
    "#plt.errorbar(x_axis, -train_scores, yerr=train_stds,label =  +' Train')\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.98873649,  0.98944855,  0.99026478,  0.98998566])"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_means"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 2 candidates, totalling 10 fits\n",
      "[CV] min_child_samples=40 ............................................\n",
      "[CV] min_child_samples=40 ............................................\n",
      "[CV] min_child_samples=40 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] min_child_samples=40 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=40, score=0.9910169117504136, total=   1.7s\n",
      "[CV] min_child_samples=40 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=40, score=0.9908520640996031, total=   2.3s\n",
      "[CV] min_child_samples=50 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .... min_child_samples=40, score=0.983337792259761, total=   2.9s\n",
      "[CV] min_child_samples=50 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=40, score=0.9914656148173555, total=   3.6s\n",
      "[CV] min_child_samples=50 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=50, score=0.9914897387526439, total=   2.1s\n",
      "[CV] min_child_samples=50 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... min_child_samples=50, score=0.9836478591436575, total=   2.2s\n",
      "[CV] min_child_samples=50 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done   6 out of  10 | elapsed:    6.2s remaining:    4.1s\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .... min_child_samples=50, score=0.991297497481703, total=   1.9s\n",
      "[CV] ... min_child_samples=40, score=0.9941476351551455, total=   4.3s\n",
      "[CV] ... min_child_samples=50, score=0.9896121212733415, total=   1.8s\n",
      "[CV] ... min_child_samples=50, score=0.9941154944412636, total=   1.4s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done  10 out of  10 | elapsed:    8.1s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 3, 5, 6, 12, 15, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=0.7, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=20, min_child_weight=....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid=True, n_jobs=4,\n",
       "       param_grid={'min_child_samples': range(40, 60, 10)},\n",
       "       pre_dispatch='2*n_jobs', refit=False, return_train_score='warn',\n",
       "       scoring='roc_auc', verbose=5)"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': [0,1,3,5,6,12,15,16,17,18,19,20],\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 70,\n",
    "          'max_depth': 6,\n",
    "          'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "min_child_samples_s = range(40,60,10) \n",
    "tuned_parameters = dict( min_child_samples = min_child_samples_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4,  param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(X_train , y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.990163886445\n",
      "{'min_child_samples': 40}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('mean_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('std_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAD8CAYAAABZ/vJZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3Xmcj/X+//HHazb7bkgIhWpEaFBhpsXagkRpVam0SJlTp/rW2ZzTKaeO0aKio8VpkbRQicHRjC0ZRJYwJGshS1HR5PX7Yy7nN2cazceYmc8sz/vtNrf5fN7X+3Ndr/cN83Rd1+fzGnN3REREjlVEuAsQEZGSSQEiIiL5ogAREZF8UYCIiEi+KEBERCRfFCAiIpIvChAREckXBYiIiOSLAkRERPIlKtwFFKbatWt748aNw12GiEiJsnjx4l3uHpvXvFIdII0bNyY9PT3cZYiIlChm9lUo83QJS0RE8kUBIiIi+aIAERGRfFGAiIhIvihAREQkXxQgIiKSLwoQERHJFwVILtydv09dzYad+8NdiohIsaUAycWXuw4w4dNN9HxyDs+nrifzl8PhLklEpNhRgOTi5NjKzEhKJLF5LI999AV9np3Hqm3fhbssEZFiJaQAMbMeZrbGzDLM7IFctjcys1lmttzMPjazBtm2jTCzFcHXldnGm5jZQjNbZ2ZvmllMMJ5gZkvMLNPM+uU4zklmlmJmq81slZk1zu/C81K3annGXHcWz17Tlq/3/USvZ+byz5Q1HMz8pbAOKSJSouQZIGYWCYwGegJxwFVmFpdj2hPAeHdvBQwHHg1eezHQFmgNdADuM7OqwWtGAMnu3gzYAwwKxjcBNwCv51LOeOBxdz8daA/sCG2Z+WNmXNSyHjOGJdKr9Yk8/Z8MLnpyDou/2l2YhxURKRFCOQNpD2S4+wZ3PwRMAHrnmBMHzAoez862PQ5IdfdMdz8ALAN6mJkBFwCTgnmvAH0A3H2juy8H/ufGQxBaUe4+I5i3391/CH2p+VejUgwj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A+f9GkfUD5HDwvBaw190zg+dbgPrhKKwQ5VzzfwWXrq4DphV1UYUstzUPAaa4+/bwlFSoclvvKcCVZpZuZh+ZWbPwlFZoclvzzcBUM9tC1t/rx8JRWCFzIMXMFpvZrcFY3SN/r4PvdQrygAoQwMwuAXa4++Lsw7lMLTVvWTvKmrN7Fkhz9zlFWFahym3NZnYi0B94OmyFFZLf+DMuB/wUXOZ4AXixyIsrJL+x5mHARe7eAHgJGFnkxRW+ju7eFugJ3GlmCYV9wKjCPkAJ0RHoZWYXAeXJOtUdBVQ3s6jgLKQBpeu091drNrNX3f1aM/sTEAsMDmuFBS+3P+eVwEEgI+uqJRXNLMPdS8NN1lz/jMk6m347mPMuWT9QS4vc1vwhWfd7FgZz3qT0nVnj7tuC7zvM7F2gPfCNmdVz9+1mVg8o2MuV7q6vbF/AecAHweO3gAHB4+eBO8JdXxGs+WZgPlAh3HUV1ZpzjO8Pd21F8Gf8GHBTtvFF4a6vMNdM1n+UdwHNg/FBwNvhrq+A11oJqJLt8XygB1n39h4Ixh8A/lGQx9UZyG+7H5hgZn8DlgLjwlxPUXierA7GC4L/kb/j7sPDW5IUsMeA18xsGLCf0vlOu/9y90wzuwV428wOk/WOypvCXFZBqwu8G/ybjQJed/dpZrYImGhmg4BNZF2uLTD6JLqIiOSLbqKLiEi+KEBERCRfFCAiIpIvChAREckXBYiIiOSLAkRERPJFASIiIvmiABERkXz5f8SzfPmfHNQiAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# plot CV误差曲线\n",
    "test_means = grid_search.cv_results_[ 'mean_test_score' ]\n",
    "test_stds = grid_search.cv_results_[ 'std_test_score' ]\n",
    "train_means = grid_search.cv_results_[ 'mean_train_score' ]\n",
    "train_stds = grid_search.cv_results_[ 'std_train_score' ]\n",
    "\n",
    "x_axis = min_child_samples_s\n",
    "\n",
    "plt.plot(x_axis, test_means)\n",
    "#plt.errorbar(x_axis, -test_scores, yerr=test_stds ,label = ' Test')\n",
    "#plt.errorbar(x_axis, -train_scores, yerr=train_stds,label =  +' Train')\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 5 candidates, totalling 25 fits\n",
      "[CV] colsample_bytree=0.5 ............................................\n",
      "[CV] colsample_bytree=0.5 ............................................\n",
      "[CV] colsample_bytree=0.5 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] colsample_bytree=0.5 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .... colsample_bytree=0.5, score=0.950957410195987, total=   2.4s\n",
      "[CV] colsample_bytree=0.5 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.5, score=0.9499790773452238, total=   3.0s\n",
      "[CV] colsample_bytree=0.6 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.5, score=0.9546020451595396, total=   3.8s\n",
      "[CV] colsample_bytree=0.6 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.5, score=0.9670208654890527, total=   4.6s\n",
      "[CV] colsample_bytree=0.6 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.6, score=0.9835439318584576, total=   1.9s\n",
      "[CV] colsample_bytree=0.6 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.6, score=0.9932012805122048, total=   3.3s\n",
      "[CV] colsample_bytree=0.6 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.5, score=0.9579739504105518, total=   4.8s\n",
      "[CV] colsample_bytree=0.7 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.6, score=0.9909958735374725, total=   4.2s\n",
      "[CV] colsample_bytree=0.7 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.7, score=0.9914656148173555, total=   2.3s\n",
      "[CV] colsample_bytree=0.7 ............................................\n",
      "[CV] ... colsample_bytree=0.6, score=0.9940987353547394, total=   2.9s\n",
      "[CV] ... colsample_bytree=0.6, score=0.9923312256677578, total=   3.7s\n",
      "[CV] colsample_bytree=0.7 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] colsample_bytree=0.7 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "[Parallel(n_jobs=4)]: Done  10 tasks      | elapsed:   11.3s\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .... colsample_bytree=0.7, score=0.983337792259761, total=   3.3s\n",
      "[CV] colsample_bytree=0.8 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.7, score=0.9908520640996031, total=   2.1s\n",
      "[CV] colsample_bytree=0.8 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.7, score=0.9910169117504136, total=   2.8s\n",
      "[CV] colsample_bytree=0.8 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.7, score=0.9941476351551455, total=   3.7s\n",
      "[CV] colsample_bytree=0.8 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.8, score=0.9909217401246213, total=   3.0s\n",
      "[CV] colsample_bytree=0.8 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.8, score=0.9837711084433773, total=   3.2s\n",
      "[CV] colsample_bytree=0.9 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .... colsample_bytree=0.8, score=0.991316820622937, total=   3.2s\n",
      "[CV] colsample_bytree=0.9 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.8, score=0.9894491219386544, total=   3.3s\n",
      "[CV] colsample_bytree=0.9 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.8, score=0.9939058910714474, total=   3.0s\n",
      "[CV] colsample_bytree=0.9 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.9, score=0.9886109872520437, total=   2.6s\n",
      "[CV] colsample_bytree=0.9 ............................................\n",
      "[CV] .... colsample_bytree=0.9, score=0.979468587434974, total=   2.3s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.9, score=0.9874338982779537, total=   2.5s\n",
      "[CV] ... colsample_bytree=0.9, score=0.9879355238913404, total=   2.0s\n",
      "[CV] ... colsample_bytree=0.9, score=0.9934373253783535, total=   1.6s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done  25 out of  25 | elapsed:   22.8s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 3, 5, 6, 12, 15, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=1.0, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=40, min_child_weight=....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid=True, n_jobs=4,\n",
       "       param_grid={'colsample_bytree': [0.5, 0.6, 0.7, 0.8, 0.9]},\n",
       "       pre_dispatch='2*n_jobs', refit=False, return_train_score='warn',\n",
       "       scoring='roc_auc', verbose=5)"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': [0,1,3,5,6,12,15,16,17,18,19,20],\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 70,\n",
    "          'max_depth': 6,\n",
    "          'min_child_samples':40\n",
    "          #'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "colsample_bytree_s = [i/10.0 for i in range(5,10)]\n",
    "tuned_parameters = dict( colsample_bytree = colsample_bytree_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4,  param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(X_train , y_train)\n",
    "#grid_search.best_estimator_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.990834098093\n",
      "{'colsample_bytree': 0.6}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('mean_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('std_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3X2UVfV97/H3dx55muFphsdBQ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yz/fuVDIKRTjRXgnvCUa5WZJWszpbvuQPcLLl4ltr/7dTVwtZn9Mnz9hb1YNxv9guweLyA4tSf4ZPvT3q47wP2C7B6vvwL+0MwSwBqCs5d0181GvwCmhUNJPzOzz2WoT+n260LVpDN+vPIhENKpxvoqMNXdZwE/AZ7vxbrZ6BdcuErsQPSrhGB45laCT5bfMbNRaa6bjX5Bdo9X0n3AKnfvvIR1e6sv/YLsHq/7ge+5ew1wB/CvFtRCy/bxulC/9hIcrznAnwM/MLNKMqMv1aQzfrzyIRDSqcZ6yIOqqgDfBuamu26W+oVfoErsQPQrbPOKu7eHp+47CN6Is3q8LtKvbB+vpPs4f1gm28frQv3K9vH6OlAfvv7bwBCCWj3ZPl7d9iscwjoUzt9AMOZ/9UD1yy9cTTrzx6s/LpQM5IPgU+NuglPi5EWZa1LaTIxMLwbe8XMXZfYQXJAZHU6PyYF+jQbKw+kqYCcXuWDYD/1aCDwfef04MDYHjteF+pXV4xW2+wzwEeF3e3Lh9+si/cr279drwAPh9EyCNzEDruH8i8q7ydxF5b70qzrZD4KLv00D/HtfBRSF008Cy/vr96vPO5QLD4LTuw8IkvvxcN5y4M5w+ilgW3iw1wMzIuv+N4KLV7uA/5oL/QJuBraE87cAXx/gfhnwdwSlyrcA9+XI8eq2X9k+XuHzvyKo5pu6btaO14X6le3jRXCR9Jfh628Cfjey7uPhejuA23OhXwTj98n/p+8CXxngfi0hCO0PgO8Qhnl//H7pm8oiIgLkxzUEERHJAAWCiIgACgQREQkpEEREBFAgiIhISIEgIiKAAkFEREIKBBERAeD/A7YsF2Rz9vX1AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_means = grid_search.cv_results_[ 'mean_test_score' ]\n",
    "test_stds = grid_search.cv_results_[ 'std_test_score' ]\n",
    "train_means = grid_search.cv_results_[ 'mean_train_score' ]\n",
    "train_stds = grid_search.cv_results_[ 'std_train_score' ]\n",
    "\n",
    "x_axis = colsample_bytree_s\n",
    "\n",
    "plt.plot(x_axis, test_means)\n",
    "#plt.errorbar(x_axis, -test_scores[:,i], yerr=test_stds[:,i] ,label = str(max_depths[i]) +' Test')\n",
    "#plt.errorbar(x_axis, -train_scores[:,i], yerr=train_stds[:,i] ,label = str(max_depths[i]) +' Train')\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 3 candidates, totalling 15 fits\n",
      "[CV] colsample_bytree=0.3 ............................................\n",
      "[CV] colsample_bytree=0.3 ............................................\n",
      "[CV] colsample_bytree=0.3 ............................................\n",
      "[CV] colsample_bytree=0.3 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.3, score=0.9704542388383924, total=   2.3s\n",
      "[CV] colsample_bytree=0.3 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.3, score=0.9793746151723454, total=   3.2s\n",
      "[CV] colsample_bytree=0.4 ............................................\n",
      "[CV] ... colsample_bytree=0.3, score=0.9699501142809448, total=   3.4s\n",
      "[CV] colsample_bytree=0.4 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.3, score=0.9791349682730235, total=   4.4s\n",
      "[CV] colsample_bytree=0.4 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.3, score=0.9754275059311096, total=   3.0s\n",
      "[CV] colsample_bytree=0.4 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.4, score=0.9667416680958096, total=   2.9s\n",
      "[CV] colsample_bytree=0.4 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.4, score=0.9495438175270108, total=   3.6s\n",
      "[CV] ... colsample_bytree=0.4, score=0.9508654823524838, total=   2.6s\n",
      "[CV] colsample_bytree=0.5 ............................................\n",
      "[CV] colsample_bytree=0.5 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.4, score=0.9580626817385188, total=   2.0s\n",
      "[CV] colsample_bytree=0.5 ............................................\n",
      "[CV] ... colsample_bytree=0.4, score=0.9558960532580812, total=   2.9s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] colsample_bytree=0.5 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] ... colsample_bytree=0.5, score=0.9499790773452238, total=   3.1s\n",
      "[CV] ... colsample_bytree=0.5, score=0.9670208654890527, total=   3.1s\n",
      "[CV] colsample_bytree=0.5 ............................................\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n",
      "[Parallel(n_jobs=4)]: Done  12 out of  15 | elapsed:   11.7s remaining:    2.9s\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[CV] .... colsample_bytree=0.5, score=0.950957410195987, total=   3.4s\n",
      "[CV] ... colsample_bytree=0.5, score=0.9546020451595396, total=   3.5s\n",
      "[CV] ... colsample_bytree=0.5, score=0.9579739504105518, total=   2.1s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Done  15 out of  15 | elapsed:   14.1s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 3, 5, 6, 12, 15, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=1.0, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=40, min_child_weight=....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid=True, n_jobs=4,\n",
       "       param_grid={'colsample_bytree': [0.3, 0.4, 0.5]},\n",
       "       pre_dispatch='2*n_jobs', refit=False, return_train_score='warn',\n",
       "       scoring='roc_auc', verbose=5)"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': [0,1,3,5,6,12,15,16,17,18,19,20],\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 70,\n",
    "          'max_depth': 6,\n",
    "          'min_child_samples':40\n",
    "          #'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "colsample_bytree_s = [i/10.0 for i in range(3,6)]\n",
    "tuned_parameters = dict( colsample_bytree = colsample_bytree_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4,  param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(X_train , y_train)\n",
    "#grid_search.best_estimator_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.974868228594\n",
      "{'colsample_bytree': 0.3}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "best n_estimators: 19\n",
      "best cv score: 0.990037707242\n"
     ]
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': [0,1,3,5,6,12,15,16,17,18,19,20],\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.01,\n",
    "          #'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 70,\n",
    "          'max_depth': 6,\n",
    "          'min_child_samples':40,\n",
    "          'colsample_bytree': 0.3\n",
    "         }\n",
    "n_estimators_2 = get_n_estimators(params , X_train , y_train, early_stopping_rounds=50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py:731: UserWarning: categorical_feature keyword has been found in `params` and will be ignored.\n",
      "Please use categorical_feature argument of the Dataset constructor to pass this parameter.\n",
      "  .format(key))\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 3, 5, 6, 12, 15, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=0.4, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.01, max_depth=6,\n",
       "        min_child_samples=40, min_child_weight=0.001, min_split_gain=0.0,\n",
       "        n_estimators=100, n_jobs=4, num_leaves=75, objective='binary',\n",
       "        random_state=None, reg_alpha=0.0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0)"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': [0,1,3,5,6,12,15,16,17,18,19,20],\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.01,\n",
    "          #'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 75,\n",
    "          'max_depth': 6,\n",
    "          'min_child_samples':40,\n",
    "          'colsample_bytree': 0.4\n",
    "         }\n",
    "\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "lg.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.DataFrame({\"columns\":list(feat_names), \"importance\":list(lg.feature_importances_.T)})\n",
    "df = df.sort_values(by=['importance'],ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>importance</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Monthly_Income</td>\n",
       "      <td>1413</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Interest_Rate</td>\n",
       "      <td>567</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Loan_Tenure_Submitted</td>\n",
       "      <td>518</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Loan_Tenure_Applied</td>\n",
       "      <td>371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Var1</td>\n",
       "      <td>349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Source</td>\n",
       "      <td>319</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Device_Type</td>\n",
       "      <td>155</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Gender</td>\n",
       "      <td>146</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Age</td>\n",
       "      <td>144</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>EMI_Loan_Submitted_Missing</td>\n",
       "      <td>111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Var5</td>\n",
       "      <td>106</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Existing_EMI</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Filled_Form</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Loan_Amount_Submitted</td>\n",
       "      <td>101</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Processing_Fee</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Mobile_Verified</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Loan_Amount_Applied</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Var4</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>LoggedIn</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Var2</td>\n",
       "      <td>37</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       columns  importance\n",
       "11              Monthly_Income        1413\n",
       "4                Interest_Rate         567\n",
       "8        Loan_Tenure_Submitted         518\n",
       "7          Loan_Tenure_Applied         371\n",
       "14                        Var1         349\n",
       "13                      Source         319\n",
       "0                  Device_Type         155\n",
       "3                       Gender         146\n",
       "18                         Age         144\n",
       "19  EMI_Loan_Submitted_Missing         111\n",
       "17                        Var5         106\n",
       "1                 Existing_EMI         104\n",
       "2                  Filled_Form         104\n",
       "6        Loan_Amount_Submitted         101\n",
       "12              Processing_Fee          90\n",
       "10             Mobile_Verified          90\n",
       "5          Loan_Amount_Applied          87\n",
       "16                        Var4          71\n",
       "9                     LoggedIn          43\n",
       "15                        Var2          37"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAD8CAYAAAB6paOMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAE8pJREFUeJzt3X+MZeV93/H3p6zBtZN4FzM4ZHfdxcnKLYmaerUiJG4tFFIM2GJpZCqQFVY21coKTu2mUbyupRA5jYSbNrSuEqqN2XqJEMYldljF6+IVdmRVKsQL5qexvWNCYAxmNwXjtCh1SL794z7TXGZnZmfmzp077PN+SVf3nOc8557vnHvnfuY859w7qSokSf36O5MuQJI0WQaBJHX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y5dbX5E36Hx11ba//k7GtrqO9a7rOF3ifG8jrzk8WS1LlTeWhIkrQEBoEkdc4gkKTOGQSS1DmDQJI6ZxBIUucMAknqnEEgSZ37fxT9o8PhIU7IAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.bar(range(len(lg.feature_importances_)), lg.feature_importances_)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
